home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 May (DVD) / Macworld Resource DVD May 2003.toast / Data / Software / Bonus / Database / mysql-max-3.23.55.sit / mysql-max-3.23.55-apple-darwi.1 / mysql-test / t / null.test < prev    next >
Encoding:
Text File  |  2003-01-21  |  1.4 KB  |  38 lines  |  [TEXT/ttxt]

  1. #
  2. # Testing of NULL in a lot of different places
  3. #
  4.  
  5. select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
  6. select 1 | NULL,1 & NULL,1+NULL,1-NULL;
  7. select NULL=NULL,NULL<>NULL,IFNULL(NULL,1.1)+0,IFNULL(NULL,1) | 0;
  8. select strcmp("a",NULL),(1<NULL)+0.0,NULL regexp "a",null like "a%","a%" like null;
  9. select concat("a",NULL),replace(NULL,"a","b"),replace("string","i",NULL),replace("string",NULL,"i"),insert("abc",1,1,NULL),left(NULL,1);
  10. select repeat("a",0),repeat("ab",5+5),repeat("ab",-1),reverse(NULL);
  11. select field(NULL,"a","b","c");
  12. select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
  13. SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0;
  14. SELECT (NULL OR NULL) IS NULL;
  15. select NULL AND 0, 0 and NULL;
  16. select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
  17.  
  18. drop table if exists t1;
  19. create table t1 (x int);
  20. insert into t1 values (null);
  21. select * from t1 where x != 0;
  22. drop table t1;
  23.  
  24. #
  25. # Test problem med index on NULL columns and testing with =NULL;
  26. #
  27.  
  28. DROP TABLE IF EXISTS t1;
  29. CREATE TABLE t1 (
  30.   indexed_field int default NULL,
  31.   KEY indexed_field (indexed_field)
  32. );
  33. INSERT INTO t1 VALUES (NULL),(NULL);
  34. SELECT * FROM t1 WHERE indexed_field=NULL;
  35. SELECT * FROM t1 WHERE indexed_field IS NULL;
  36. SELECT * FROM t1 WHERE indexed_field<=>NULL;
  37. DROP TABLE t1;
  38.